package ar.com.bdf.ipharma.protocolo.gui;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesManager {

	// Read properties file.
	private static Properties properties = null;

	public static String get(String key) {
		initInstance();
		return (String) properties.get(key);
	}

	private static void initInstance() {
		try {
			if (properties == null) {
				loadFile();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private synchronized static void loadFile() throws IOException, FileNotFoundException {
		InputStream inputStream = PropertiesManager.class.getClassLoader().getResourceAsStream("resources/protocolo.properties");
		properties = new Properties();
		properties.load(inputStream);
	}

}
